package sweezy.swf.tools.flex
{
	import mx.controls.dataGridClasses.DataGridColumn;
	import mx.core.ClassFactory;

	public class BinaryColumnBase extends DataGridColumn
	{
		
		private var _offset:uint;
		
		public function get offset():uint{
			return _offset;
		}

		public function BinaryColumnBase()
		{
			itemEditor = new ClassFactory(Editor);

			setStyle("textAlign", "center");
			setStyle("paddingLeft", "1");
			setStyle("paddingRight", "1");
			setStyle("fontFamily", "_typewriter");
			setStyle("fontSize", 12);
		}

		public function set offset(value:uint):void
		{
			_offset = value;
			
			var label:String = "0" + value.toString(16);
			dataField = "h" + label;
			headerText = label.toLocaleUpperCase();
		}
	}
}

import mx.controls.TextInput;

class Editor extends TextInput
{

	public function Editor()
	{
		maxChars = 2;
		restrict = "[0-9a-fA-F]";
	}
}
